<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!--数据格式化标签库-->
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="<%=basePath%>/static/js/jquery-3.3.1.js"></script>
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>/static/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>/static/css/basic.css">
<script src="<%=basePath%>/static/js/bootstrap.min.js"></script>
<style type="text/css">
.table>thead>tr>th {
	padding: 13px 2px 10px;
}

.table-bordered>thead>tr>th {
	border-bottom-width: 0
}

.white_content {
	display: none;
	position: absolute;
	top: 35%;
	left: 25%;
	width: 50%;
	height: auto;
	padding: 20px;
	border: 1px solid gray;
	background-color: white;
	z-index: 1002;
	overflow: auto;
	border-radius: 8px;
}

.black_overlay {
	display: none;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.3);
	z-index: 1001;
	filter: alpha(opacity = 88);
}
</style>
<script type="text/javascript">
	$(function() {

		$(".closeBtn").on("click", function() {
			$("#fade").fadeOut(600).hide(300);
			$("#light-watch").fadeOut(600).hide(300);
			$("#span3").fadeOut(600).hide(300);
		});

		$(".btn-watch").on("click", function() {

			let parent = $(this).parent().parent();
			// let bookId = parent.find(".bookId").text();
			// alert(bookId);
			$("#span1").val(parent.find(".overday").text());
			$("#span2").val(parent.find(".penalty").text());
			if(parent.find(".penalty").text()>0){
				
				$("#span3").hide().fadeIn(600).css("dispaly","block");
			}
			$("#light-watch").hide().fadeIn(600).css("display", "block");
			$("#fade").hide().fadeIn(600).css("display", "block");
		});
	})
</script>
</head>
<body>
	<!--头部-->
	<nav class="navbar navbar-inverse navbar-fixed-top">
		<div class="container-fluid">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed"
					data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
					aria-expanded="false">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="javascript:;">欢迎来到图书管理系统</a>
			</div>
			<!-- Collect the nav links, forms, and other content for toggling -->
			<div class="collapse navbar-collapse"
				id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav navbar-right">
					<!--<li><a href="javascript:;" class="btn btn-default btn-login">登录</a></li>-->
					<li class="dropdown" style="margin-top: 5px;"><a href="#"
						class="dropdown-toggle" data-toggle="dropdown" role="button"
						aria-haspopup="true" aria-expanded="false"> <span
							class="glyphicon glyphicon-user"></span> 欢迎您，${reader.name }<span
							class="caret"></span></a>
						<ul class="dropdown-menu" style="margin-top: 2px">
							<li><a href="<%=path%>/">退出</a></li>
						</ul></li>
				</ul>
			</div>
			<!-- /.navbar-collapse -->
		</div>
		<!-- /.container-fluid -->
	</nav>
	<!--主体-->
	<div class="container-fluid" id="main">
		<div class="row">
			<div class="col-md-2 left-content">
				<div class="aside-nav">
					<ul class="list-group aside-nav-list">
						<li class="list-group-item "><a
							href="<%=path%>/reader/books/1">图书查询 <span
								class="pull-right glyphicon glyphicon-chevron-right"></span>
						</a></li>
						<li class="list-group-item "><a
							href="<%=path%>/reader/borrow/1">借阅信息 <span
								class="pull-right glyphicon glyphicon-chevron-right"></span>
						</a></li>
						<li class="list-group-item active"><a
							href="<%=path%>/reader/overdue/1">逾期信息 <span
								class="pull-right glyphicon glyphicon-chevron-right"></span>
						</a></li>
						<li class="list-group-item "><a
							href="<%=path%>/lesson/reader/chooseTest">在线考试 <span
								class="pull-right glyphicon glyphicon-chevron-right"></span>
						</a></li>
					</ul>
				</div>
			</div>
			<div class="col-md-10 right-content">
				<div class="section-wrap">
					<div class="wrap-top">
						<div class="panel panel-default">
							<div class="panel-heading">罚金查询</div>
							<div class="panel-body">
								<form class="form-horizontal"
									action="<%=path%>/reader/overdue/select" method="post">
									<div class="form-group col-md-6">
										<label for="borrowId"
											class="col-sm-4 control-label text-right">借阅编号</label>
										<div class="col-sm-8">
											<input type="text" class="form-control" id="borrowId"
												name="borrowId" placeholder="请输入借阅编号">
										</div>
									</div>
									<div class="form-group col-md-6">
										<label for="libCardId"
											class="col-sm-4 control-label text-right">证件号</label>
										<div class="col-sm-8">
											<input type="text" class="form-control" id="libCardId"
												name="libCardId" placeholder="请输入读者证件号">
										</div>
									</div>
									<div class="form-group col-md-6">
										<label for="isbn" class="col-sm-4 control-label text-right">图书ISBN号</label>
										<div class="col-sm-8">
											<input type="isbn" class="form-control" id="isbn" name="isbn"
												placeholder="请输入借阅图书的ISBN号">
										</div>
									</div>
									<div
										class="form-group col-md-3 col-xs-3 col-xs-offset-3 last-form-group">
										<button class="btn btn-default btn-primary" type="submit">查询</button>
									</div>
								</form>
							</div>
						</div>
					</div>
					<div class="wrap-bottom">
						<table class="table table-bordered">
							<thead>
								<tr>
									<th>借阅编号</th>
									<th>图书ISBN号</th>
									<th>图书名称</th>
									<th>读者证件号</th>
									<th>读者名称</th>
									<th>逾期天数</th>
									<th>需缴纳罚金</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="message" items="${bean.list}">
									<tr>
										<td>${message.borrowId }</td>
										<td>${message.isbn }</td>
										<td>${message.bookName }</td>
										<td>${message.libCardId }</td>
										<td>${message.name }</td>
										<td class="overday">${message.overday }</td>
										<td class="penalty">${message.penalty }</td>
										<td>
											<button class="btn btn-info btn-xs btn-watch"
												style="margin-right: 3px">查看</button>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
					<div class="page-nav text-right">
						<nav aria-label="Page navigation">
							<ul class="pagination">
								<c:if test="${bean.totalPage!=0}">
									<li><a href="#">第${bean.pageNum}页/共${bean.totalPage}页</a></li>
									<c:if test="${select==false }">
										<li><a href="<%=path%>/reader/overdue/1">首页</a></li>
									</c:if>
									<c:if test="${select==true }">
										<li><a href="#">首页</a></li>
									</c:if>
									<%--如果当前为第一页时,就没有上一页这个超链接显示 --%>
									<c:if test="${bean.pageNum==1}">
										<c:forEach begin="${bean.start }" end="${bean.end }" step="1"
											var="i">
											<c:if test="${bean.pageNum ==i}">
												<li><a href="#">${i}</a></li>
											</c:if>
											<c:if test="${bean.pageNum !=i}">
												<c:if test="${select==false }">
													<li><a href="<%=path %>/reader/overdue/${i}">${i}</a></li>
												</c:if>
												<c:if test="${select==true }">
													<li><a href="<%=path %>/reader/overdue/select/${i}">${i}</a></li>
												</c:if>
											</c:if>
										</c:forEach>
										<c:if test="${bean.totalPage!=1}">
											<c:if test="${select==false }">
												<li><a
													href="<%=path %>/reader/overdue/${bean.pageNum+1}"
													aria-label="Next"> <span aria-hidden="true">&raquo;</span>
												</a></li>
											</c:if>
											<c:if test="${select==true }">
												<li><a
													href="<%=path %>/reader/overdue/select/${bean.pageNum+1}"
													aria-label="Next"> <span aria-hidden="true">&raquo;</span>
												</a></li>
											</c:if>
										</c:if>
									</c:if>
									<%--如果当前页不是第一页也不是最后一页,则有上一页和下一页 这个超链接的显示--%>
									<c:if
										test="${bean.pageNum >1 && bean.pageNum < bean.totalPage}">
										<c:if test="${select==false }">
											<li><a
												href="<%=path %>/reader/overdue/${bean.pageNum-1}"
												aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
											</a></li>
										</c:if>
										<c:if test="${select==true }">
											<li><a
												href="<%=path %>/reader/overdue/select/${bean.pageNum-1}"
												aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
											</a></li>
										</c:if>
										<c:forEach begin="${bean.start }" end="${bean.end }" step="1"
											var="i">

											<c:if test="${bean.pageNum == i }">
												<li><a href="#">${i }</a></li>
											</c:if>
											<c:if test="${bean.pageNum != i }">
												<c:if test="${select==false }">
													<li><a href="<%=path %>/reader/overdue/${i}">${i}</a></li>
												</c:if>
												<c:if test="${select==true }">
													<li><a href="<%=path %>/reader/overdue/select/${i}">${i}</a></li>
												</c:if>
											</c:if>
										</c:forEach>
										<c:if test="${select==false }">
											<li><a
												href="<%=path %>/reader/overdue/${bean.pageNum+1}"
												aria-label="Next"> <span aria-hidden="true">&raquo;</span>
											</a></li>
										</c:if>
										<c:if test="${select==true }">
											<li><a
												href="<%=path %>/reader/overdue/select/${bean.pageNum+1}"
												aria-label="Next"> <span aria-hidden="true">&raquo;</span>
											</a></li>
										</c:if>
									</c:if>
									<%--如果当前页是最后一页,则只有上一页这个超链接显示,下一页没有 --%>
									<c:if
										test="${bean.pageNum ==  bean.totalPage && bean.pageNum!=1}">
										<c:if test="${select==false }">
											<li><a
												href="<%=path %>/reader/overdue/${bean.pageNum-1}"
												aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
											</a></li>
										</c:if>
										<c:if test="${select==true }">
											<li><a
												href="<%=path %>/reader/overdue/select/${bean.pageNum-1}"
												aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
											</a></li>
										</c:if>
										<c:forEach begin="${bean.start }" end="${bean.end }" step="1"
											var="i">

											<c:if test="${bean.pageNum == i }">
												<li><a href="#">${i }</a></li>
											</c:if>
											<c:if test="${bean.pageNum != i }">
												<c:if test="${select==false }">
													<li><a href="<%=path %>/reader/overdue/${i}">${i}</a></li>
												</c:if>
												<c:if test="${select==true }">
													<li><a href="<%=path %>/reader/overdue/select/${i}">${i}</a></li>
												</c:if>
											</c:if>
										</c:forEach>
									</c:if>
									<c:if test="${select==false }">
										<li><a
											href="<%=path %>/reader/overdue/${bean.totalPage }">尾页</a></li>
									</c:if>
									<c:if test="${select==true }">
										<li><a href="#">尾页</a></li>
									</c:if>
								</c:if>
							</ul>
						</nav>
					</div>
				</div>
			</div>
		</div>
	</div>
	<%--弹出层的半透明背景--%>
	<div id="fade" class="modal black_overlay"></div>
	<%--弹出查看图书详情的弹出窗--%>
	<div id="light-watch" class="white_content">
		<button type="button" class="close closeBtn" data-dismiss="modal"
			aria-label="Close">
			<span aria-hidden="true">×</span>
		</button>
		<div class="row">
			<div class="col-md-10 col-sm-offset-1">
				<!--保证样式水平不混乱-->
				<form class="form-horizontal" >
					<div class="modal-body">
						<!---------------------表单-------------------->
						<div class="row">
							<div class="form-group col-md-6">
								<label for="isbn-add" class="col-md-4 control-label">逾期天数</label>
								<div class="col-md-8">
									<input type="text" class="form-control" id="span1"/>
								</div>
							</div>
							<div class="form-group col-md-6">
								<label for="isbn-add" class="col-md-4 control-label">应付金额</label>
								<div class="col-md-8">
									<input type="text" class="form-control" id="span2" />
								</div>
							</div>
						</div>
						<!---------------------表单-------------------->
					</div>
				</form>
					<span style="font-size: 20px;margin-left: 211px;display: none" class="text-danger" id="span3">请前往图书馆交钱</span>
			</div>
		</div>
	</div>
</body>
</html>